
var reg=/.*/;

function byzz(){
	
	//^.+@.+(\..+)*\.com$
	//^$这两个符号可以帮助正则执行时判断是从字符第一位开始比较，到最后以为，必须全部匹配才行，如果不加这的话，只要字符串中有任意一处匹配，就能算匹配
	var text=$("text").value;
	var reg=$("reg").value;
	var regx=new RegExp(reg);
	//alert(regx.test(text));
	var obj=regx.exec(text);//text.match(regx).length
	alert(obj);
}

// var string="akfsjdlakfsd";//被严重字符串
// var reg=/.+/;//正则，（.+）非空判断
// var isok=reg.test(string);
// alert(isok);

var peo={
		showName:function(name){
			
		alert(name);
		},
		addEvent:function(target,evtName,func){
			if(document.addEventListener){
				target.addEventListener(evtName, func, true);
			} else if(document.attachEvent){
				target.attachEvent('on' + evtName, func);
			}
		}
        
}

function peopleLoad(){
	
	var len=People.peopleHode.length;
	
	for(var i=0;i<len;i++){
		var peo2=People.peopleHode[i];
		peo2.initial();
	}
	
	
}
peo.addEvent(window,'load',peopleLoad);

function People(){
	this.reaname="xx";
	this.namelist=new Array();
	this.namelist.push({
		index:1,
		name:this.reaname
	});
	People.peopleHode.push(this);
	
}
People.peopleHode=new Array();

People.prototype={
		
		writlen:function(name){
			
			$("txa").value=$("txa").value+"\n"+name;
		}
		,
		initContainer:function(){
			
			this.container=document.createElement("textarea");
			this.container.id="txa";
			this.container.cols="20";
			this.container.rows="5";
			document.body.appendChild(this.container);
		}
		,
		initial:function(){
			
			this.initContainer();
		}
		,
		showNamelist:function(){
			
			for(var i=0;i<this.namelist.length;i++){
				
				var namew=this.namelist[i];

				this.writlen("下标:"+namew.index+" 名称:"+namew.name);
			}
		}
		,
		addName:function(newname){
			
			this.namelist.push({
				index:this.namelist.length,
				name:newname
			});
			this.reaname=newname;
		}
		,
		getLength:function(charlist){
			
			var ss=charlist.length;
			alert(ss);
		}
}

function $(id){
	return document.getElementById(id);
}
